package com.ecoolex.ying.space.ws;

import java.util.Date;

import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;
import com.ecoolex.framework.common.exception.BizException;
import com.ecoolex.framework.common.pojo.Page;
import com.ecoolex.framework.common.pojo.Pagination;
import com.ecoolex.framework.common.pojo.Sorting;
import com.ecoolex.ying.space.core.manager.UserWorksCommentManager;
import com.ecoolex.ying.space.core.manager.UserWorksCommentReadStateManager;
import com.ecoolex.ying.space.entity.UserWorksComment;

@Service
public class UserWorksCommentServiceImpl implements UserWorksCommentService{
	
	@Autowired
	private UserWorksCommentManager userWorksCommentManager;

	@Override
	public UserWorksComment addUserWorksComment(UserWorksComment record, String createUser) throws BizException {
		return userWorksCommentManager.addUserWorksComment(record, createUser);
	}

	@Override
	public UserWorksComment addUserWorksReply(UserWorksComment record, String createUser) throws BizException {
		return userWorksCommentManager.addUserWorksReply(record, createUser);
	}

	@Override
	public void delete(UserWorksComment record, String updateUser) {
		userWorksCommentManager.delete(record, updateUser);
	}

	@Override
	public UserWorksComment getByIdForH5(Integer commentId) {
		return userWorksCommentManager.getByIdForH5(commentId);
	}
	
	@Override
	public Pagination<UserWorksComment> queryCommentForH5(Date now,Integer worksId,Sorting[] sorts, Page page) {
		return userWorksCommentManager.queryCommentForH5(now,worksId, sorts, page);
	}
	
	@Override
	public Pagination<UserWorksComment> queryReplyForH5(Integer lastCommentId,Date now, Sorting[] sorts, Page page) {
		return userWorksCommentManager.queryReplyForH5(now,lastCommentId, sorts, page);
	}

	@Override
	public Pagination<UserWorksComment> queryByCommentUserIdForH5(Integer commentUserId, Sorting[] sorts, Page page) {
		return userWorksCommentManager.queryByCommentUserIdForH5(commentUserId, sorts, page);
	}

	@Override
	public Pagination<UserWorksComment> queryByBeCommentUserIdForH5(Integer beCommentUserId,Date now, Sorting[] sorts, Page page) {
		return userWorksCommentManager.queryByBeCommentUserIdForH5(now,beCommentUserId, sorts, page);
	}

	@Override
	public UserWorksComment getById(Integer commentId) {
		return userWorksCommentManager.getById(commentId);
	}

	@Override
	public Pagination<UserWorksComment> queryByOpus(String title, Sorting[] sorts, Page page) {
		return userWorksCommentManager.queryByOpus(title, sorts, page);
	}

	@Override
	public boolean praseComment(Integer commentId, String updateUser) throws BizException {
		return userWorksCommentManager.praseComment(commentId, updateUser);
	}

	@Override
	public Pagination<UserWorksComment> queryByInspiration(String title, Sorting[] sorts, Page page) {
		return userWorksCommentManager.queryByInspiration(title, sorts, page);
	}

	@Autowired
	private UserWorksCommentReadStateManager userWorksCommentReadStateManager;
	
	@Override
	public void updateUserWorksCommentReadState(Integer readUserId, String createUser) {
		userWorksCommentReadStateManager.updateUserWorksCommentReadState(readUserId, createUser);
	}

	@Override
	public long unreadReceivedCommentCount(Integer userId) {
		return userWorksCommentManager.unreadReceivedCommentCount(userId);
	}

}
